package com.layfuture.lftserver.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.modulith.core.ApplicationModuleDetectionStrategy;
import org.springframework.modulith.core.JavaPackage;

import java.util.stream.Stream;

/**
 * 自定义应用模块策略
 */
@Slf4j
class CustomApplicationModuleDetectionStrategy implements ApplicationModuleDetectionStrategy {
    /**
     * 过滤目标子包
     *
     * @param basePackage
     * @return
     */
    @Override
    public Stream<JavaPackage> getModuleBasePackages(JavaPackage basePackage) {
        return basePackage.getDirectSubPackages().stream().filter(p -> !p.getName().contains("com.layfuture.lftserver.config"));
    }
}
